<!--Descriptive page name, messages and instructions-->
<% if @collection %>
  <h2><%= link_to(@collection.title, @collection) %> > <%=h ts("Fandoms") %></h2>
<% elsif @medium %>
  <h2><%= link_to ts('Fandoms'), media_path %> > <%=h @medium.name %></h2>
<% else %>
  <h2><%= link_to ts('Fandoms'), media_path %></h2>
<% end %>

<% if @collection %>
<div class="filters">
  <%= form_tag '', :method => :get do %>
    <%= select_tag :medium_id, options_for_select([''] + @media.map{|m| m.name}, params[:medium_id]) %>
    <%= submit_tag "Go" %>
  <% end %>
</div>
<% end %>
<!--/descriptions-->

<!--main content-->
<% if @fandoms_by_letter %>
  <ul class="alphabet">
    <% for letter in @fandoms_by_letter.keys %>
      <li><%= link_to letter, "#letter-#{letter}" %></li>
    <% end %>
  </ul>
  <ul class="letters <%= 'collection' if @collection %>">
    <% @fandoms_by_letter.each_pair do |letter, fandoms| %>
      <li id='letter-<%= letter %>' class='letter'>
        <h3>
          <%= letter %>
          <span class="top"><%= link_to "top", "#skiplinks" %></span>
        </h3>
        <ul class="fandom index">
          <% for fandom in fandoms %>
          <li class='<%= cycle('odd', 'even', :name => "letter-#{letter}") %>'>
            <%= link_to_tag_works_with_text(fandom, fandom.name) %>
            <% if fandom.respond_to?(:count) %>
              (<%= fandom.count %>)
            <% end %>
          </li>
          <% end %>
        </ul>
      </li>
    <% end %>
  </ul>
<% end %>
<!--/content-->
